﻿using ShawnFramework;
using System;

public class GameFlowManager : ILifeCycle
{
    GameFlowEnum gameFlow = GameFlowEnum.Login;
    public GameFlowEnum GameFlow
    {
        get
        {
            return gameFlow;
        }
        set
        {
            if (value != gameFlow) 
            {
                gameFlow = value;

                // 跳转场景
                GameUtil.JumpToScene(Enum.GetName(typeof(GameFlowEnum), gameFlow), (isDone, progress) =>
                {
                    if (isDone && progress == 1.0f)
                    {
                        $"场景加载完成, sceneName: {gameFlow.ToString()}".Dump();
                    }
                });
            }
        }
    }
    public void OnInit()
    {
        PanelUtil.OpenPanelByName(Global.Instance.PanelContainer, "LoginPanel");
    }

    public void OnTick()
    {
        
    }

    public void OnUninit()
    {
        
    }
}